﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Mimoza.Common;

namespace Mimoza.ObjectLayer
{

    public enum ObjectLayerEventType { ObjectInserted, ObjectUpdated, ObjectDeleted };
    public class ObjectLayer_ObjectChangedEventArgs : EventArgs
    {
        public ObjectLayer_ObjectChangedEventArgs(object obj, ObjectLayerEventType type)
        {
            this.obj = obj;
            this.type = type;
        }
        private object obj;
        private ObjectLayerEventType type;

        public object Object
        {
            get { return obj; }
        }
        public ObjectLayerEventType EventType
        {
            get { return type; }
        }

    }
    public class OL 
    {
        private IDBLayer dbLayer;
        private HostRepository hostRepository;
        private PolicyRepository policyRepository;
        private ContainerRepository containerRepository;
        private UpdateRepository updateRepository;

        public OL( IDBLayer dbLayer )
        {
            this.dbLayer = dbLayer;
            this.hostRepository = new HostRepository(this);
            this.policyRepository = new PolicyRepository(this);
            this.containerRepository = new ContainerRepository(this);
            this.updateRepository = new UpdateRepository(this);
        }

        public IDBLayer DBLayer 
        {
            get { return dbLayer; }
        }

        public ContainerRepository ContainerRepository
        {
            get { return containerRepository; }
        }
        public HostRepository HostRepository
        {
            get { return hostRepository; }
        }
        public PolicyRepository PolicyRepository
        {
            get { return policyRepository; }
        }
        public UpdateRepository UpdateRepository
        {
            get { return updateRepository; }
        }
    }
}
